﻿Shader "custom/intermediate/cutaways_discard_cullOff_2" {
	Properties {
		_threshold("threshold", Range(-1.0,1.0)) = 0.0
	}
	SubShader {		
		Pass{
			Cull Off
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			uniform float _threshold;
			struct vertexInput
			{
				float4 vertex:POSITION;
			};
			struct vertexOutput
			{
				float4 pos:SV_POSITION;
				float4 posObject:TEXCOORD1;
			};
			vertexOutput vert(vertexInput i)
			{
				vertexOutput o;
				o.pos = mul(UNITY_MATRIX_MVP, i.vertex);
				o.posObject = i.vertex;
				return o;
			}		
			float4 frag(vertexOutput o) : Color
			{
				if(o.posObject.y > _threshold)
				{
					discard;				
				}
				return float4(1.0,1.0,1.0,1.0);
			}
			ENDCG
		}
	} 
	FallBack "Diffuse"
}
